--[[
    * Author:Dzlua
    * QQ:505544956
    * Time:2017/03/12
--]]
set_project("Demos")
set_version("1.0.0")
--set_warnings("all", "error")
set_languages("c99", "cxx11")

add_cxflags("-EHsc")

if is_mode("release") then
    set_symbols("hidden")
    set_optimize("fastest")
    set_strip("all")
    add_defines("NDEBUG")
    add_cxflags("-O1","-Ob1","-GF")
elseif is_mode("debug") then
    set_symbols("debug")
    set_optimize("none")
    add_defines("DEBUG","_DEBUG")
    add_cxflags("-Od","-Gm","-RTC1","-ZI")
end

add_defines("WIN32","_WINDOWS")
add_links("kernel32","user32","gdi32","winspool","comdlg32","advapi32","shell32","ole32","oleaut32","uuid","odbc32","odbccp32")
add_cxflags("-Gs","-EHsc","-Gd","-Gy")

add_includedirs("out/inc")
add_includedirs("demos")
add_linkdirs("out/lib")

option("spdui-unicode")
    set_default(true)
    set_showmenu(true)
    set_description("The type of spdui  true:unicode(default),false:ansi")
    add_defines("_UNICODE","UNICODE")
option("spdui-shared")
    set_default(true)
    set_showmenu(true)
    set_description("The type of spdui  true:shared(default),false:static")
    add_defines("SHARED","_SHARED")
option("spdui")
    set_default(true)
    set_showmenu(false)
    if is_mode("debug") then
        if is_option("spdui-shared") then
            add_cxflags("-MDd")
        else
            add_cxflags("-MTd")
        end
    elseif is_mode("release") then
        if is_option("spdui-shared") then
            add_cxflags("-MD")
        else
            add_cxflags("-MT")
        end
    end
    if not is_option("spdui-shared") then
        add_defines("UILIB_STATIC")
    end
option("lua4spdui")
    set_default(true)
    set_showmenu(false)
    add_defines("_LUA4SPDUI","LUA4SPDUI")

target("hello")
    set_kind("binary")
    add_options("spdui-unicode","spdui-shared","spdui")
    add_includedirs("demos/hello")
    add_files("demos/hello/**.cpp")

target("sdtool")
    set_kind("binary")
    add_options("spdui-unicode","spdui-shared","spdui")
    add_includedirs("demos/sdtool")
    add_files("demos/sdtool/src/**.cpp")

target("testlua")
    set_kind("binary")
    add_options("spdui-unicode","spdui-shared","spdui","lua4spdui")
    add_includedirs("demos/testlua")
    add_files("demos/testlua/**.cpp")